from app import db

from app.models.base_model import BaseModel


class AuthRolePermission(BaseModel):
    __tablename__ = 'auth_role_permission'
    __table_args__ = ({'comment': '角色权限表'})
    id = db.Column(db.Integer, primary_key=True, comment="记录ID")
    role_id = db.Column(db.Integer, db.ForeignKey('auth_role.id'), nullable=False, comment="角色ID")
    permission_id = db.Column(db.Integer, db.ForeignKey('auth_permission.id'), nullable=False, comment="权限ID")

    def __repr__(self) -> str:
        return "<AuthRolePermission %s>" % self.to_json()
